package com.eiisan.web.web.feign;

import com.eiisan.core.mapper.MapperUtils;
import com.eiisan.web.feign.PaymentChannelClientApi;
import com.eiisan.web.mapper.PaymentChannelMapper;
import com.eiisan.web.model.domain.PaymentChannel;
import com.eiisan.web.model.dto.PaymentChannelDTO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author gragonfly
 * @date 2019/7/17
 **/
@RestController
@Api(tags = "API - PaymentChannelFeign")
public class PaymentChannelClient implements PaymentChannelClientApi {
    @Autowired
    private PaymentChannelMapper paymentChannelMapper;
    /**
     * 查询所有支付渠道
     * @return
     */
    @GetMapping("/selectAll")
    public List<PaymentChannelDTO> selectAll(){
        List<PaymentChannel> paymentChanneList = paymentChannelMapper.selectAll();
        return MapperUtils.mapAsList(paymentChanneList, PaymentChannelDTO.class);
    }
}
